package me.uniauto.swagger;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * Created by hardy on 2018/2/23.
 */
@Configuration
@EnableWebMvc
@EnableSwagger2
//TODO swgger-ui切换环境时候调用
//测试时
@ComponentScan(basePackages = "me.uniauto")
//正式的
//@ComponentScan(basePackages = "")

public class SwaggerConfig {

    @Bean
    public Docket platformApi(){
        return new Docket(DocumentationType.SWAGGER_2).groupName("full-platform").apiInfo(apiInfo());
    }

    private ApiInfo apiInfo(){
        return new ApiInfoBuilder().title("demo")
                .contact(new Contact("test","","test@uinauto.me")).license("Apache License Version 2.0")
                .licenseUrl("https://github.com/springfox/springfox/blob/master/LICENSE").version("2.0").build();
    }

}
